# 构建阶段
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# 生产镜像
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000
ENV MONGO_URI=mongodb://mongo:27017/nux_enterprise
ENV JWT_SECRET=your_jwt_secret

EXPOSE 3000
CMD [ "npm", "start" ]